package javase.reflection.proxy;

import java.lang.reflect.Proxy;

public class ActionFactory {
	public static Action getAction(boolean returnProxy) {
		Action result = new ActionImpl();
		if (returnProxy) {
			result = (Action) Proxy.newProxyInstance(
					ActionFactory.class.getClassLoader(), 
					new Class[]{Action.class}, 
					new InvocationHandlerImpl(result));
		}
		return result;
	}
}
